#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-12-01 9:28 上午
# @Author  : yangdy
# @File    : 2020-12-01.剑指Offer64.求1+2+…+n
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def searchRange(self, nums: List[int], target: int) -> List[int]:
        if not nums:
            return [-1, -1]
        import bisect
        x, y = bisect.bisect_left(nums, target), bisect.bisect_right(nums, target)
        x = x if x < len(nums) and nums[x] == target else -1
        y = y - 1 if y > 0 and x < len(nums) and nums[x] == target else -1
        return [x, y]
